package com.example.administrator.testpersionn.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;


public class HomePagerRecyclerViewAdapter extends RecyclerView.Adapter<com.example.administrator.testpersionn.adapter.HomePagerRecyclerViewAdapter.ViewHolder> {

    Context context;
    List<String> recyclerviewBeanList;

    public HomePagerRecyclerViewAdapter(Context context, List<String> recyclerviewBeanList) {
        this.context = context;
        this.recyclerviewBeanList = recyclerviewBeanList;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {

     return  new ViewHolder(LayoutInflater.from(context).inflate(android.R.layout.simple_list_item_1,viewGroup,false));
    }

    @Override
    public void onBindViewHolder(@NonNull com.example.administrator.testpersionn.adapter.HomePagerRecyclerViewAdapter.ViewHolder viewHolder, int i) {
        viewHolder.textView.setText(recyclerviewBeanList.get(i));
    }



    @Override
    public int getItemCount() {
        return recyclerviewBeanList.size();
    }

    class ViewHolder extends RecyclerView.ViewHolder{
        TextView textView;
        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            textView= (TextView) itemView;
        }
    }

}
